package hip.util.db;

import hip.util.PropertiesUtil;

import java.util.Properties;

/**
 * @author andong
 * @description datasourceTest 常量
 * @date 2013-1-5
 */
public class DataSourcePingConstants {
    private static final Properties urlProperties = PropertiesUtil.loadProperties("dataSource.properties");
    // private static final Properties urlProperties = PropertiesUtil.getProperties("/dataSourceURL.properties");

    // DRIVERS 1:oracle 2:MYsql 3:SQLServe 4:db2 5:SYBASE 6:postgresql 7:DM 8:cache
    public static final String[] DRIVERS = {"", "oracle.jdbc.OracleDriver", "com.mysql.jdbc.Driver", "net.sourceforge.jtds.jdbc.Driver", "com.ibm.db2.jcc.DB2Driver", "com.sybase.jdbc4.jdbc.SybDriver", "org.postgresql.Driver", "dm.jdbc.driver.DmDriver", "com.intersys.jdbc.CacheDriver"};

    // port 1:oracle 2:MYsql 3:SQLServe 4:db2 5:SYBASE 6:postgresql 7:DM 8:cache
    public static final String[] DEFAULTPORTS = {"", "1521", "3306", "1433", "50000", "5000", "5432", "5236", "1972"};

    // connectionURL 1:oracle 2:MYsql 3:SQLServe 4:db2 5:SYBASE 6:POSTGRESQL 7:DM 8:cache
    public static final String[] URL = {"", urlProperties.getProperty("oracle"), urlProperties.getProperty("mysql"), urlProperties.getProperty("sqlserver"), urlProperties.getProperty("db2"), urlProperties.getProperty("sybase"), urlProperties.getProperty("postgresql"), urlProperties.getProperty("dm"), urlProperties.getProperty("cache")};

    public static final String[] SERVERURL = {"", urlProperties.getProperty("oracleSV"), urlProperties.getProperty("mysql"), urlProperties.getProperty("sqlserver"), urlProperties.getProperty("db2"), urlProperties.getProperty("sybase"), urlProperties.getProperty("postgresql"), urlProperties.getProperty("dm"), urlProperties.getProperty("cache")};

    // PING SQL 1:oracle 2:MYsql 3:SQLServe 4:db2 5:SYBASE 6:POSTGRESQL 7:DM 8:cache
    public static final String[] PINGSQL = {"", "select sysdate from dual", "select now()", "select GETDATE()", "SELECT current date FROM sysibm.sysdummy1", "select getdate()", "select now()", "select * from dual", "select top 1 getdate() from ABT_DrugAuthor"};

    // PAGE
    public static final String ORACL_PAGE_SQL = "select t.* from " + "(select row_.*, rownum rownum_ from "
            + "( ${SELECT} ${FROM} ${WHERE} ) row_ where rownum <=10 ) t " + "where rownum_ > 0";

    public static final String MYSQL_PAGE_SQL = "${SELECT} ${FROM}  ${WHERE} LIMIT 10,0";

    public static final String SQLSERVER_PAGE_SQL = "SELECT TOP 10 * FROM ( ${SELECT} ${FROM}  ${WHERE} ) A";

    public static final String DB2_PAGE_SQL = "SELECT * FROM (${SELECT} ${FROM}  ${WHERE}) A WHERE ROWNUM > 0 AND ROWNUM <=10";

    public static final String SYBASE_PAGE_SQL = "{call GetDataByLine(?,?,?)}";

    public static final String POSTGRESQL_PAGE_SQL = "${SELECT} ${FROM}  ${WHERE} LIMIT 10,0";

    public static final String DM_PAGE_SQL = "${SELECT} ${FROM}  ${WHERE} LIMIT 10,0";

    public static final String[] PAGESQL = {"", ORACL_PAGE_SQL, MYSQL_PAGE_SQL, SQLSERVER_PAGE_SQL, DB2_PAGE_SQL, SYBASE_PAGE_SQL, POSTGRESQL_PAGE_SQL, DM_PAGE_SQL};

    public static final String DATABASE_ORCLE = "1";

    public static final String DATABASE_MYSQL = "2";

    public static final String DATABASE_SQLSERVER = "3";

    public static final String DATABASE_DB2 = "4";

    public static final String DATABASE_SYBASE = "5";

    public static final String DATABASE_POSTGRESQL = "6";

    public static final String DATABASE_DM = "7";

    public static final String DATABASE_CACHE = "8";
}
